define(function (require, exports, module) {
    let loading;
    let loadingTimer;
    const showLoading = (delay=0)=>{
        loadingTimer = setTimeout(() => {
            loading = ELEMENT.Loading.service({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
              });
        }, delay);
    }
    const hideLoading = ()=>{
        if(loadingTimer) {
            clearTimeout(loadingTimer);
            loadingTimer = null;
        }
        loading && loading.close();
    }
  // 深度继承
const assignDeep = function (target, source) {
    if (typeof (source) !== 'object' || typeof (target) !== 'object') Object.assign(target, source);
    else {
        for (const key in source) {
            if (source.hasOwnProperty(key)) {
                if (typeof (source[key]) === 'object' && typeof (target[key]) !== 'undefined' && target[key] !==null) {
                    assignDeep(target[key], source[key]);
                } else {
                    if(!target) target = {};
                    target[key] = typeof (source[key]) === 'undefined' ? target[key] : source[key];
                }
            }
        }
    }
};

module.exports={
    showLoading,
    hideLoading,
    assignDeep,
}
});

